← Back
Editing: index70.js
import{K as e,aq as a,l as t,L as s,bu as n,b as o,o as r,at as l,u as i,aM as c,a6 as m,p,v as u,a8 as d,ag as _}from"./utils-lib.js?v=1765440387";import{_ as v}from"./index93.js?v=1765440387";import{_ as f}from"./index120.js?v=1765440387";import{g as j,r as y,at as g,c as b,s as h,e as x,B as w,w as k,p as C,n as O,q as P,v as E,x as N,M as L,A as S,y as B,C as I,P as T,J as D}from"./base-lib.js?v=1765440387";import{c as M,a as R,d as V,g as q,u as A}from"./column.js?v=1765440387";import{b as J,g as F,s as U,c as K,d as z,f as Q,h as W,u as G,a as H,j as X}from"./useController6.js?v=1765440387";import{u as Y,S as Z}from"./useStore3.js?v=1765440387";import{u as $}from"./index131.js?v=1765440387";import{L as ee,M as ae,N as te,O as se,P as ne,Q as oe,K as re,J as le}from"./site.js?v=1765440387";import{l as ie,i as ce,o as me,h as pe}from"./validator.js?v=1765440387";const ue=o(),{siteInfo:de,isRefreshList:_e,activeType:ve}=Y(),{setSiteInfo:fe}=Z(),je=j(()=>!!de.value),ye=y("0"),ge=y([]),be=g("_node_mask",!1),he=async()=>{var a;const t=await e({loading:"正在设置,请稍后...",request:ae({version:ye.value})});ue.request({status:null==(a=t.data)?void 0:a.status,msg:t.data.data||t.data.error_msg})},xe=async()=>{try{const{data:e}=await a({sName:"nodejs"});await ie({name:"nodejs",softData:e})}catch(e){}},we=()=>{de.value=null,t({title:"添加Node项目",area:80,component:()=>s(()=>import("./index352.js?v=1765440387"),__vite__mapDeps([]),import.meta.url),showFooter:!0})},ke=()=>{t({title:"PM2监控",area:120,showFooter:!1,component:()=>s(()=>import("./index353.js?v=1765440387"),__vite__mapDeps([]),import.meta.url)})},Ce=(e,a)=>{fe(e,a),t({isAsync:!0,title:"Node项目管理["+e.name+"] -- 添加时间["+e.addtime+"]",area:[84,71],component:()=>s(()=>import("./index354.js?v=1765440387"),__vite__mapDeps([]),import.meta.url)})},Oe=async e=>{try{const{data:a}=await ne({version:e});return a.package_managers}catch(a){l(a)}},Pe=y({nodejs_versions:[],package_managers:[],user_list:[],maximum_memory:0}),Ee=async()=>{var e,a,t,s;try{const o=await te();return Object.assign(Pe.value,{...null==o?void 0:o.data,maximum_memory:(null==(e=null==o?void 0:o.data)?void 0:e.maximum_memory)||0,nodejs_versions:n(null==(a=null==o?void 0:o.data)?void 0:a.nodejs_versions,"array",[]),user_list:n(null==(t=null==o?void 0:o.data)?void 0:t.user_list,"array",[]),package_managers:n(null==(s=null==o?void 0:o.data)?void 0:s.package_managers,"array",[])}),o.data}catch(o){return Pe.value}},Ne=async a=>{a&&(await e({loading:"正在保存修改,请稍后...",request:oe(a),message:!0}),_e.value=!0)},Le=async(e,a,t,s,n,o)=>{const{label:r,value:l}=s,{enable:i,exclude:c}=o,m=new Map([["start","批量启动选中项目后,项目将正常访问"],["stop","批量停用选中的项目后,项目将会停止运行"],["restart","批量重启选中的项目后,项目将会重新启动"],["delete","批量删除选中的项目后,项目将无法恢复"]]);await e({title:"批量".concat(r),content:"".concat(m.get(l),",是否继续操作?"),column:[{label:"项目名称",prop:"name"},M()],onConfirm:async()=>{const e=await(async()=>{const e=new Map([["start",le],["stop",le],["restart",le]]).get(l);switch(l){case"start":case"stop":case"restart":if(e){const a=t.value.map(e=>e.project_config.pm2_name?{id:e.id,project_name:e.name,project_type:e.project_config.project_type||"nodejs",pm2_name:e.project_config.pm2_name}:{id:e.id,project_name:e.name,project_type:e.project_config.project_type||"nodejs"}),s=pe(!1,c,i,{params:{site_list:JSON.stringify(a),status:l,project_type:"NODE"}});return await e(s,ve.value)}case"delete":const a=t.value.map(e=>e.project_config.pm2_name?{id:e.id,name:e.name,project_type:e.project_config.project_type||"nodejs",pm2_name:e.project_config.pm2_name}:{id:e.id,name:e.name,project_type:e.project_config.project_type||"nodejs"}),s=pe(!1,c,i,{params:{project_type:ve.value.toUpperCase(),site_list:JSON.stringify(a)}});return await re(s)}})();_e.value=!0,n&&n();let{data:a}=ce(e.data);a=a.map(e=>({...e,name:e.name||e.project_name})),me(a,{title:"".concat(r,"网站")})}})},Se={class:"content-mask"},Be={class:"flex items-center mx-12px"},Ie=b({__name:"index",setup(e){i();const{getSiteList:a,setSiteInfo:t}=Z(),{activeType:o,isRefreshList:l,siteInfo:j,searchWidth:y}=h(Z()),{BtOperation:g}=c({options:[{type:"button",label:"添加项目",active:!0,onClick:()=>{var e;if(!(null==(e=ge.value)?void 0:e.length))return xe();we()}},{type:"button",label:"Node版本管理器",onClick:xe},{type:"button",label:"PM2监控",onClick:ke}]}),b=$({key:"type_id",name:"Node分类",options:()=>[{label:"全部分类",value:"all"}],event:W,ignore:["0"],field:"type_name"}),M=d([{label:"启动项目",value:"start",event:Le},{label:"停用项目",value:"stop",event:Le},{label:"重启项目",value:"restart",event:Le},G(),H({classList:X}),{label:"删除项目",value:"delete",event:Le}]),{BtTable:Y,BtPage:ae,BtRefresh:te,BtSearch:ne,BtColumn:oe,BtBatch:re,BtTableCategory:le,refresh:ie,config:ce}=m({request:e=>{const{type_id:t,...s}=e;return a({data:JSON.stringify({...s,type_id:p(t)||"all"===t?"":t})})},columns:[R({type:"page",key:"id"}),J({onClick:e=>{Ce(e)}}),F({type:o.value,onClick:(e,a)=>{if("setting"===a)return void Ce(e,"state");const t=e.run?"stop":"start";U(e,"restart"===a?a:t)}}),{label:"PID",isCustom:!0,render:e=>{const a=n(e.load_info,"object",{});if(0==Object.keys(a).length)return"--";let t=[];for(var s in e.load_info)e.load_info.hasOwnProperty(s)&&t.push(s);return t.join(",")}},{label:"CPU",isCustom:!1,render:e=>{const a=n(e.load_info,"object",{});if(0==Object.keys(a).length)return"--";let t=0;for(var s in e.load_info)t+=e.load_info[s].cpu_percent;return t.toFixed(2)+"%"}},{label:"内存",isCustom:!1,render:e=>{const a=n(e.load_info,"object",{});if(0==Object.keys(a).length)return"--";let t=0;for(var s in e.load_info)t+=e.load_info[s].memory_used;return u(t)}},V(),K(),q({table:"sites",width:200}),{label:"Node版本",isCustom:!0,render:e=>e.project_config.nodejs_version||"--"},z({onClick:e=>{Ce(e,"ssl")}}),A([{title:"设置",onClick:e=>{Ce(e)}},{title:"删除",onClick:e=>{(async e=>{await r({type:"default",title:"删除项目-".concat(e.name),content:"风险操作,此操作不可逆,删除【".concat(e.name,"】项目后您将无法管理该项目,是否继续操作?"),input:{content:"删除项目"}});try{let a=e.project_config,t={project_name:a.project_name,project_type:a.project_type||"nodejs"};a.pm2_name&&(t.pm2_name=a.pm2_name);const s=await se(t);ue.request(s),_e.value=!0}catch(a){}})(e)}}])],extension:[b,M],empty:()=>x("span",null,[w("您的列表为空,您可以"),x("span",{class:"bt-link",onClick:we},[w("添加一个项目")])])});return k(l,async e=>{var a;if(e){if(await ie(),null==(a=j.value)?void 0:a.name){const e=ce.data.find(e=>e.name===j.value.name);e&&t(e)}l.value=!1}}),C(()=>{(async()=>{var e;try{const a=await ee();if(ge.value=[],!a.status)return void(be.value=!0);be.value=!1,null==(e=a.data)||e.forEach(e=>{e.setup&&ge.value.push({label:e.version,value:e.version}),1===e.is_default&&(ye.value=e.version)}),ge.value.unshift({label:"未设置",value:"0"})}catch(a){}})(),O(()=>{s(()=>import("./index352.js?v=1765440387"),__vite__mapDeps([]),import.meta.url),s(()=>import("./index354.js?v=1765440387"),__vite__mapDeps([]),import.meta.url)})}),(e,a)=>{const t=f,s=_,n=v;return P(),E("div",null,[N(be)?(P(),L(t,{key:0},{content:S(()=>[B("div",Se,[a[3]||(a[3]=B("i",{class:"svgtofont-el-warning text-warning !text-[2.2rem] mr-4px"},null,-1)),a[4]||(a[4]=w(" 未安装Node版本管理器,",-1)),B("span",{class:"bt-link",onClick:a[0]||(a[0]=(...e)=>N(xe)&&N(xe)(...e))},"点击安装")])]),_:1})):I("",!0),x(n,null,{"header-left":S(()=>[x(N(g)),B("div",Be,[a[5]||(a[5]=B("span",{class:"mr-4px"},"命令行版本",-1)),x(s,{class:"!w-[10rem]",modelValue:N(ye),"onUpdate:modelValue":a[1]||(a[1]=e=>T(ye)?ye.value=e:null),options:N(ge),onChange:N(he)},null,8,["modelValue","options","onChange"])]),B("div",{class:"flex items-center ml-1rem",onClick:a[2]||(a[2]=(...e)=>N(Q)&&N(Q)(...e))},[...a[6]||(a[6]=[B("i",{class:"svgtofont-desired text-[1.6rem]"},null,-1),B("span",{class:"bt-link"},"需求反馈",-1)])])]),"header-right":S(()=>[x(N(le),{class:"!w-[140px] mr-[10px]"}),x(N(ne),{class:D(["mr-[10px]","!w-[".concat(N(y),"px]")]),placeholder:"请输入项目名称或备注"},null,8,["class"]),x(N(te),{class:"mr-[10px]"}),x(N(oe))]),content:S(()=>[x(N(Y))]),"footer-left":S(()=>[x(N(re))]),"footer-right":S(()=>[x(N(ae))]),_:1})])}}}),Te=Object.freeze(Object.defineProperty({__proto__:null,default:Ie},Symbol.toStringTag,{value:"Module"}));export{Te as a,Ee as g,je as i,Pe as n,xe as o,Ne as s,Oe as u}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) }
Save File
Cancel